package structure.Composite;

import java.util.List;

/**
 * Created by LYJ on 2016/10/19.
 * 树叶
 */
public class Leaf extends Component {
    public Leaf(String name) {
        super(name);
    }

    @Override
    protected void add(Component component)throws UnsupportedOperationException {
        throw new UnsupportedOperationException();
    }

    @Override
    protected void remove(Component component) throws UnsupportedOperationException{
        throw new UnsupportedOperationException();
    }

    @Override
    protected void operation(int depth) {
        String temp="";
        for (int i=0;i<depth;i++){
            temp+="    ";
        }
        System.out.println(temp+this.name);
    }

    @Override
    protected List<Component> getChildren() throws UnsupportedOperationException {
        throw new UnsupportedOperationException();
    }
}
